<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    public function up(): void
    {
        /**
         * 当门票订单需要验证游客时 有该数据
         */
        Schema::create('scenic_order_passengers', function (Blueprint $table) {
            $table->id();
            $table->string('order_sn',32)->comment('订单编号');
            $table->uuid('user_id')->comment('用户id');
            $table->string('passenger_id',32)->comment('乘客id');
            $table->string('truename',32)->comment('乘客姓名');
            $table->unsignedTinyInteger('identity_type')->default(1)->comment('证件类型 1 身份证');
            $table->string('identity_code', 25)->comment('证件号');
            $table->unsignedTinyInteger('passenger_type')->comment('乘客类型 1 成人 2 学生 3 儿童');
            $table->string('mobile', 11)->default('')->comment('手机号');
            $table->timestamps();
            $table->index('order_sn', 'idx_ordersn');
            $table->index('user_id', 'idx_userid');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('scenic_order_passengers');
    }
};
